package com.chaintor.demo.math;

import org.apache.commons.math3.distribution.NormalDistribution;
import org.apache.commons.math3.util.FastMath;

public class SigmaToStrike {
    /**
     * 给定delta及对应的波动率、到期天数及对应汇率的汇率计算出价格
     * @param f
     * @param delta
     * @param sigma
     * @param expToToday
     * @return
     */
    static public double CalcStrike(double f,double delta,double sigma,double expToToday){
        NormalDistribution normal= new NormalDistribution();
        return f* FastMath.exp(-normal.inverseCumulativeProbability(delta)*sigma*FastMath.sqrt(expToToday/365.0)+0.5*sigma*sigma*(expToToday/365.0));
    }
}
